home *** CD-ROM | disk | FTP | other *** search
/ 500 MB Nyheder Direkte fra Internet 9 / 500 MB nyheder direkte fra internet CD 9.iso / start / zipped / dos / novell / sdk.exe / SDK / INCLUDE / NWLOCALE.H < prev    next >
C/C++ Source or Header  |  1995-08-07  |  13KB  |  425 lines

  1.  
  2. /*--------------------------------------------------------------------------
  3.  
  4.    $Workfile:   nwlocale.h  $
  5.    $Revision:   1.48  $
  6.    $Date:   07 Aug 1995 09:05:56  $
  7.    $Copyright:
  8.  
  9.    Copyright (c) 1989-1995 Novell, Inc.  All Rights Reserved.                      
  10.  
  11.    THIS WORK IS  SUBJECT  TO  U.S.  AND  INTERNATIONAL  COPYRIGHT  LAWS  AND
  12.    TREATIES.   NO  PART  OF  THIS  WORK MAY BE  USED,  PRACTICED,  PERFORMED
  13.    COPIED, DISTRIBUTED, REVISED, MODIFIED, TRANSLATED,  ABRIDGED, CONDENSED,
  14.    EXPANDED,  COLLECTED,  COMPILED,  LINKED,  RECAST, TRANSFORMED OR ADAPTED
  15.    WITHOUT THE PRIOR WRITTEN CONSENT OF NOVELL, INC. ANY USE OR EXPLOITATION
  16.    OF THIS WORK WITHOUT AUTHORIZATION COULD SUBJECT THE PERPETRATOR TO
  17.    CRIMINAL AND CIVIL LIABILITY.$
  18.  
  19. --------------------------------------------------------------------------*/
  20.  
  21.  
  22. #if !defined( NWLOCALE_H )
  23. #define NWLOCALE_H
  24.  
  25.  
  26. /* make sure size_t is defined */
  27. #include <stddef.h>
  28.  
  29. /* make sure va_list is defined */
  30. #include <stdarg.h>
  31.  
  32. #ifndef NTYPES_H
  33. #  include "ntypes.h"
  34. #endif
  35.  
  36. #include "npackon.h"
  37.  
  38.  
  39. #if defined N_PLAT_DOS
  40. #  define NWLCODE           nuint
  41. #endif
  42.  
  43. #define NUMBER_TYPE  nint32
  44.  
  45. /* (in imitation of stdlib.h) */
  46.  
  47. #define L_MB_LEN_MAX       2   /* (in imitation of limits.h) */
  48. #define MERIDLEN           5
  49. #define NWSINGLE_BYTE      1
  50. #define NWDOUBLE_BYTE      2
  51.  
  52. #ifndef NLC_ALL
  53. #  define NLC_ALL            0
  54. #endif
  55. #ifndef LC_ALL
  56. #  define LC_ALL NLC_ALL
  57. #endif
  58.  
  59. #ifndef NLC_COLLATE
  60. #  define NLC_COLLATE        1
  61. #endif
  62. #ifndef LC_COLLATE
  63. #  define LC_COLLATE NLC_COLLATE
  64. #endif
  65.  
  66. #ifndef NLC_CTYPE
  67. #  define NLC_CTYPE          2
  68. #endif
  69. #ifndef LC_CTYPE
  70. #  define LC_CTYPE NLC_CTYPE
  71. #endif
  72.  
  73. #ifndef NLC_MONETARY
  74. #  define NLC_MONETARY       3
  75. #endif
  76. #ifndef LC_MONETARY
  77. #  define LC_MONETARY NLC_MONETARY
  78. #endif
  79.  
  80. #ifndef NLC_NUMERIC
  81. #  define NLC_NUMERIC        4
  82. #endif
  83. #ifndef LC_NUMERIC
  84. #  define LC_NUMERIC NLC_NUMERIC
  85. #endif
  86.  
  87. #ifndef NLC_TIME
  88. #  define NLC_TIME           5
  89. #endif
  90. #ifndef LC_TIME
  91. #  define LC_TIME NLC_TIME
  92. #endif
  93.  
  94. #ifndef NLC_TOTAL
  95. #  define NLC_TOTAL          6
  96. #endif
  97. #ifndef LC_TOTAL
  98. #  define LC_TOTAL NLC_TOTAL
  99. #endif
  100.  
  101.  
  102. /* -------------------------------------------------------------------------
  103.  *    country definitions
  104.  * -------------------------------------------------------------------------
  105.  */
  106.  
  107. #define ARABIC            785
  108. #define WBAHRAIN          973
  109. #define WCYPRUS           357 /* ??? */
  110. #define WEGYPT             20
  111. #define WETHIOPIA         251
  112. #define WIRAN              98
  113. #define WIRAQ             964
  114. #define WJORDAN           962
  115. #define WKUWAIT           965
  116. #define WLIBYA            218
  117. #define WMALTA            356 /* ??? */
  118. #define WMOROCCO          212 /* SHOULD THIS BE FRENCH?? */
  119. #define WPAKISTAN          92
  120. #define WQATAR            974 /* ??? */
  121. #define WSAUDI            966
  122. #define WTANZANIA         255 /* ??? */
  123. #define WTUNISIA          216 /* ??? */
  124. #define WTURKEY            90 /* ??? */
  125. #define WUAE              971
  126. #define WYEMEN            967 /* ??? */
  127. #define AUSTRALIA          61
  128. #define BELGIUM            32
  129. #define CANADA_FR           2
  130. #define CANADA              2
  131. #define DENMARK            45
  132. #define FINLAND           358
  133. #define FRANCE             33
  134. #define GERMANY            49
  135. #define GERMANYE           37
  136. #define HEBREW            972
  137. #define IRELAND           353
  138. #define ITALY              39
  139. #define LATIN_AMERICA       3
  140. #define WARGENTINA         54
  141. #define WBOLIVIA          591
  142. #define WCHILE             56
  143. #define WCOLOMBIA          57
  144. #define WCOSTARICA        506
  145. #define WECUADOR          593
  146. #define WELSALVADOR       503
  147. #define WGUATEMALA        502
  148. #define WHONDURAS         504
  149. #define WMEXICO            52
  150. #define WNICARAGUA        505
  151. #define WPANAMA           507
  152. #define WPARAGUAY         595
  153. #define WPERU              51
  154. #define WURUGUAY          598
  155. #define WVENEZUELA         58
  156. #define NETHERLANDS        31
  157. #define NORWAY             47
  158. #define PORTUGAL          351
  159. #define SPAIN              34
  160. #define SWEDEN             46
  161. #define SWITZERLAND        41
  162. #define UK                 44
  163. #define USA                 1
  164. #define JAPAN              81
  165. #define KOREA              82
  166. #define PRC                86
  167. #define TAIWAN            886 /* This one for DOS */
  168. #define WTAIWAN           886 /* This one for Windows */
  169. #define ASIAN_ENGLISH      99
  170. #define NEWZEALAND         64
  171.  
  172.  
  173. /* -------------------------------------------------------------------------
  174.  *    typedef Llconv
  175.  * -------------------------------------------------------------------------
  176.  */
  177.  
  178. typedef struct Llconv
  179.    {
  180.    char decimal_point[4];     /* non-monetary decimal point */
  181.    char thousands_sep[4];     /* non-monetary separator for digits
  182.                                  left of the decimal-point */
  183.    char grouping[4];          /* String indicating size of groups
  184.                                  of digits*/
  185.    /*
  186.     The international currency symbol applicable to
  187.     the current locale.  The first three characters
  188.     contain the alphabetic international currency
  189.     symbol in accordance with those specified in ISO
  190.     4217 "codes for the representation of currency
  191.     and funds." The fourth character is the character
  192.     used to separate the international currency
  193.     symbol from the monetary quantity.
  194.    */
  195.    char int_curr_symbol[8];
  196.    char currency_symbol[4];   /* Currency symbol for current locale */
  197.    char mon_decimal_point[4]; /* monetary decimal point */
  198.    char mon_thousands_sep[4]; /* monetary separator for digits left
  199.                                  of the decimal-point */
  200.    char mon_grouping[8];      /* String indicating size of
  201.                                  groups of digits */
  202.    char positive_sign[4];     /* String indicating positive
  203.                                  monetary value */
  204.    char negative_sign[4];     /* String indicating negative
  205.                                  monetary value */
  206.    char int_frac_digits;      /* Num of fractional digits in
  207.                                  monetary display */
  208.    char frac_digits;          /* Num of fractional digits in
  209.                                  non-monetary display*/
  210.    char p_cs_precedes;        /* 1=precede or 0=succeeds
  211.                                  (pos currency symbol)*/
  212.    char p_sep_by_space;       /* 1=space separator or
  213.                                  0=no space separator
  214.                                  (currency symbol) */
  215.    char n_cs_precedes;        /* location of currency_symbol
  216.                                  for neg monetary quantity */
  217.    char n_sep_by_space;       /* separation of currency symbol
  218.                                  in neg monetary quantity */
  219.    char p_sign_posn;          /* value indicating position of
  220.                                  positive_sign for positive
  221.                                  monetary quantity */
  222.    char n_sign_posn;          /* value indicating position of
  223.                                  negative_sign for negative
  224.                                  monetary quantity.*/
  225.  
  226.    /* Novell Additions to the ANSI definition:*/
  227.    nint         code_page;
  228.    nint         country_id;
  229.    char         data_list_separator[2];
  230.    char         date_separator[2];
  231.    char         time_separator[2];
  232.    char         time_format;
  233.    nint         date_format;
  234.     char         am[MERIDLEN];
  235.     char         pm[MERIDLEN];
  236.    char         reserved[40];
  237. } LCONV;
  238.  
  239.  
  240. /* -------------------------------------------------------------------------
  241.  *    function prototypes
  242.  * -------------------------------------------------------------------------
  243.  */
  244.  
  245. #if defined(__cplusplus)
  246. extern "C" {
  247. #endif
  248.  
  249. LCONV N_FAR * N_API NWLlocaleconv(LCONV N_FAR *lconvPtr);
  250.  
  251. nint N_API NWLmblen(pnstr string, size_t maxBytes);
  252.  
  253. pnstr N_API NWLsetlocale(nint category, const nstr N_FAR *locale);
  254.  
  255. pnstr N_API NWLstrchr(pnstr string, nint find);
  256.  
  257. /* NWLstrcoll  (see below) */
  258.  
  259. N_EXTERN_LIBRARY(size_t) NWLstrcspn
  260. (
  261.    const nstr N_FAR *string1,
  262.    const nstr N_FAR *string2
  263. );
  264.  
  265. #if !defined NWL_EXCLUDE_TIME
  266. N_EXTERN_LIBRARY(size_t) NWLstrftime
  267. (
  268.    pnstr dst,
  269.    size_t max,
  270.    const nstr N_FAR *fmt,
  271.    const struct tm N_FAR *ptm
  272. );
  273. #endif
  274.  
  275. pnstr N_API NWLstrpbrk(pnstr string1, const nstr N_FAR *string2);
  276.  
  277. pnstr N_API NWLstrrchr(pnstr string, nint find);
  278.  
  279. pnstr N_API NWLstrrev(pnstr string1, pnstr string2);
  280.  
  281. N_EXTERN_LIBRARY(size_t) NWLstrspn
  282. (
  283.    const nstr N_FAR *string1,
  284.    const nstr N_FAR *string2
  285. );
  286.  
  287. pnstr N_API NWLstrstr(pnstr string, pnstr searchString);
  288.  
  289. pnstr N_API NWLstrtok(pnstr parse, pnstr delim);
  290.  
  291. /* NWLstrupr ( see below )*/
  292.  
  293. pnstr N_API NWIncrement(pnstr string, size_t numChars);
  294.  
  295. pnstr N_API NWstrImoney(pnstr buffer, NUMBER_TYPE Value);
  296.  
  297. pnstr N_API NWstrmoney(pnstr buffer, NUMBER_TYPE Value);
  298.  
  299. nint N_API NWstrncoll(pnstr string1, pnstr string2, size_t maxBytes);
  300.  
  301. pnstr N_API NWstrncpy(pnstr target_string, pnstr source_string, nint numChars);
  302.  
  303. pnstr N_API NWLstrbcpy(pnstr target_string, pnstr source_string, nint numBytes);
  304.  
  305. pnstr N_API NWstrnum(pnstr buffer, NUMBER_TYPE Value);
  306.  
  307. N_EXTERN_LIBRARY(nint) NWstrlen
  308. (
  309.    const nstr N_FAR *string
  310. );
  311.  
  312. nint N_API NWLTruncateString(pnchar8 pStr, nint  iMaxLen);
  313.  
  314. nint N_API NWLInsertChar(pnstr src, pnstr insertableChar);
  315.  
  316. N_EXTERN_LIBRARY_C(nint)
  317. NWprintf(const nstr N_FAR *format, ...);
  318.  
  319. #ifndef NWL_EXCLUDE_FILE
  320. #  ifdef N_PLAT_DOS
  321. N_EXTERN_LIBRARY_C(nint) NWfprintf
  322. (
  323.    FILE N_FAR *stream,
  324.    const nstr N_FAR *format,
  325.    ...
  326. );
  327. #  endif
  328. #endif
  329.  
  330. #if defined N_PLAT_MSW && defined N_ARCH_32
  331. #  if !defined(__BORLANDC__)
  332. #     define NWsprintf _NWsprintf
  333. #  endif
  334. #elif defined N_PLAT_MSW  && defined N_ARCH_16
  335. #  define NWsprintf NWSPRINTF
  336. #endif
  337. N_EXTERN_LIBRARY_C(nint) NWsprintf
  338. (
  339.    pnstr buffer,
  340.    const nstr N_FAR *format,
  341.    ...
  342. );
  343.  
  344. /* Functions using variable parameter lists have the pointer to the */
  345. /* variable list declared as void instead of va_list to enable the user to */
  346. /* compile without including stdarg.h in every module. */
  347.  
  348. N_EXTERN_LIBRARY(nint)
  349. NWvprintf(const nstr N_FAR *format, va_list arglist);
  350.  
  351. #ifndef NWL_EXCLUDE_FILE
  352. #  ifdef N_PLAT_DOS
  353. N_EXTERN_LIBRARY(nint) NWvfprintf
  354. (
  355.    FILE N_FAR *stream,
  356.    const nstr N_FAR *format,
  357.    va_list arglist
  358. );
  359. #  endif
  360. #endif
  361.  
  362. N_EXTERN_LIBRARY(nint)
  363. NWvsprintf(pnstr buffer, const nstr N_FAR *format, va_list arglist);
  364.  
  365. #if defined N_PLAT_MSW && defined N_ARCH_32
  366. #  if !defined(__BORLANDC__)
  367. #     define NWwsprintf _NWwsprintf
  368. #  endif
  369. #elif defined N_PLAT_MSW && defined N_ARCH_16
  370. #  define NWwsprintf NWWSPRINTF
  371. #endif
  372. nint N_API_VARARGS NWwsprintf(pnstr buffer, pnstr format, ...);
  373.  
  374. nint N_API NWatoi(pnstr string);
  375.  
  376. pnstr N_API NWitoa(nint value, pnstr string, nuint radix);
  377. pnstr N_API NWutoa(nuint value, pnstr string, nuint radix);
  378. pnstr N_API NWltoa(nint32 value, pnstr buf, nuint radix);
  379. pnstr N_API NWultoa(nuint32 value, pnstr buf, nuint radix);
  380.  
  381. nint N_API NWisalpha(nuint ch);
  382. nint N_API NWisalnum(nuint ch);
  383. nint N_API NWisdigit(nuint ch);
  384.  
  385. void N_API NWGetNWLOCALEVersion(pnuint8 majorVersion,
  386.             pnuint8 minorVersion,
  387.             pnuint8 revisionLevel,
  388.             pnuint8 betaReleaseLevel);
  389.  
  390. #if defined N_PLAT_DOS && !defined N_LOC_NO_OLD_FUNCS
  391. NWLCODE N_API NWGetShortMachineName(pnstr shortMachineName);
  392. #endif
  393.  
  394. /* This call is not needed for Windows */
  395. nint N_API NWGetCollateTable(pnstr retCollateTable, size_t maxLen);
  396.  
  397. #if (defined N_PLAT_MSW && defined N_ARCH_16) && !defined N_LOC_NO_OLD_MACROS
  398. #  define NWNextChar(s)         AnsiNext(s)
  399. #  define NWPrevChar(t, s)      AnsiPrev(t, s)
  400. #  define NWLstrupr(s)          AnsiUpper(s)
  401. #  define NWLstrcoll(s1, s2)    lstrcmp(s1, s2)
  402. #  define NWLstrxfrm(s1, s2, t) strxfrm(s1, s2, t)
  403. #  define NWCharUpr(c)   (nint)(LOWORD((DWORD)AnsiUpper((LPSTR)(DWORD)c)))
  404. #else
  405. pnstr N_API NWNextChar(pnstr string);
  406. pnstr N_API NWPrevChar(const nstr N_FAR *string, pnstr position);
  407. pnstr N_API NWLstrupr(pnstr string);
  408. nint N_API NWLstrcoll(pnstr string1, pnstr string2);
  409. size_t N_API NWLstrxfrm(pnstr string1, pnstr string2, size_t numBytes);
  410. nint N_API NWCharUpr(nint chr);
  411. #endif /* (N_PLAT_MSW && N_ARCH_16) && !N_LOC_NO_OLD_MACROS */
  412.  
  413. nint N_API NWCharType(nint ch);
  414. nint N_API NWCharVal(pnstr);
  415.  
  416. #if defined(__cplusplus)
  417. }
  418. #endif
  419.  
  420. #include "npackoff.h"
  421.  
  422. #endif /* NWLOCALE_H */
  423.  
  424.  
  425.